# b. 根据用户输入的标题删除记录（文件二）
import pymysql
conn = pymysql.connect(database='advanced', host='localhost', user='root', password='root', charset='utf8', port=3306)
cursor = conn.cursor()
# 执行sql语句
Title = input('请输入标题:')
try:
    sql = 'delete from company_news where Title = %s'
    rows = cursor.execute(sql,[Title])
    print('受影响行数：%d' % rows)
except Exception as e:
    print(e)
    conn.rollback()
else:
    conn.commit()

cursor.close()
conn.close()